#include <iostream>

using namespace std;

int wujin = 0;
int jin = 0;
int flag = 0;
int choushu = 0;
int baodi = 0;
int up = 0;
int changzhu = 0;

void jieguo(int card)
{
    int gailv = 6;
    if(wujin > 73)
    {
        gailv = 6 + 60 * (wujin - 73);
    }
    //cout << gailv << endl;
    if(card <= gailv)
    {
        cout << "出金了！" << endl;
        flag = 1;
        jin++;
        wujin = 0;
        if(baodi == 0)
        {
            if(rand()%2)
            {
                cout << "是UP角色！" << endl;
                up++;
                baodi = 0;
            }
            else
            {
                cout << "是常驻角色" << endl;
                baodi = 1;
                changzhu++;
            }
        }
        else
        {
            cout << "是UP角色！" << endl;
            up++;
            baodi = 0;
        }
    }
    else
    {
        wujin++;
    }
}

void chouka(void)
{
    //cout << "***" << endl;
    int card = 0;
    card = rand() % 1000 + 1;
    cout << card << endl;
    jieguo(card);
}

//自娱自乐的米哈游抽卡模拟器

int main(void)
{
    cout << "单抽请输入：1" << endl;
    cout << "10连抽请输入：10" << endl;
    cout << "退出请输入：6" << endl;
    if(baodi == 0)
    {
        cout << "现在是小保底阶段" << endl;
    }
    else
    {
        cout << "现在是大保底阶段" << endl;
    }
    cout << "请选择抽卡数量：";
    int num = 0;
    cin >> num;

    while (num != 6)
    {
        if(num == 1)
        {
            cout << "您选择了单抽" << endl;
            choushu++;
            chouka();
            if(flag == 0)
            {
                cout << "很遗憾，没出金" << endl;
            }
            flag = 0;
        }
        else if(num == 10)
        {
            cout << "您选择了10连" << endl;
            choushu += 10;
            int i = 0;
            int shijin = 0;
            while (i < 10)
            {
                chouka();
                if(flag == 1)
                {
                    shijin++;
                    flag = 0;
                }
                i++;
            }
            if(shijin > 1)
            {
                cout << "10连出" << shijin << "金" << endl;
            }
            else if(shijin == 0)
            {
                cout << "很遗憾，没出金" << endl;
            }
        }
        else
        {
            cout << "您的输入我不理解，请重新输入" << endl;
        }
        cout << "单抽请输入：1" << endl;
        cout << "10连抽请输入：10" << endl;
        cout << "退出请输入：'6'" << endl;
        if(baodi == 0)
        {
            cout << "现在是小保底阶段" << endl;
        }
        else
        {
            cout << "现在是大保底阶段" << endl;
        }
        cout << "请选择抽卡数量：";
        cin >> num;
    }

    cout << "您一共抽了" << choushu << "\t张卡" << endl;
    cout << "您一共抽了" << jin << "\t张金卡" << endl;
    cout << "您一共抽了" << up << "\t张UP金卡" << endl;
    cout << "您一共抽了" << changzhu << "\t张常驻金卡" << endl;
    

    return 0;
}